<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str="JBIUUaasdcfed";
        /* .substr(第一个参数是开始的索引,第二个参数是索取的个数); */
        var res=str.substr(0,5);
        console.log(res);
        /* .substring(第一个参数是开始的索引,第二个参数是结束截取的下标)

包前不包后 */
        var res=str.substring(0,5);
        console.log(res);
    </script>
</body>
</html>